<script setup lang="ts">
const msg = useState<string>("msg");

const { id } = useRoute().params;

const { data: provider } = await useAsyncData(() =>
  $get<Provider>(`/provider/${id}`)
);

const handleSubmit = async (provider: Provider) => {
  await $put(`/provider`, provider);
  msg.value = "修改服务商成功";
  navigateTo("/provider");
};
</script>

<template>
  <PageTitle>修改服务商</PageTitle>
  <ProviderInput :provider="provider" v-if="provider" @submit="handleSubmit" />
</template>
